<!--
 * @Description:递归函数
 * @Author: Sun
 * @Date: 2019-07-01 20:05:50
 * @LastEditors: Sun
 * @LastEditTime: 2019-07-11 21:30:59
 -->
<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>递归函数</title>
	<style>
		#div1 {
			width: 200px;
			height: 200px;
			background: red;
			position: absolute;
		}
	</style>
	<script>
	   function sum(num){
			 if(num<=1){
				 return 1
			 }else{
				 return num+sum(num-1)
			 }
		 }
		 console.log(sum(15))
		   
	</script>
</head>

<body>
	<div>
		递归函数<br>
		定义： 函数体内部调用函数
		注意：能够在某种条件下跳出函数
		用处：求阶乘

	</div>
	<div id="div1">
		<span>分享到</span>
	</div>
</body>

</html>